#include "common.h"
/**
 * @param channel 根据 channel 返回对应的协议类型
 */ 
uint8 getRthFileTypeByChannel(int channel) {
    switch (channel) {
        case 0: return 0x00;
        case 1:case 2:case 3:case 4: return 0x01;
        case 5:case 6:case 7:case 8: return 0x02;
        case 9:case 10:case 11:case 12: return 0x03;
        case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21: return 0x04;
        case 22: return 0x05;
        case 23: return 0x06;
        case 24: return 0x07;
        case 25: return 0x08;
        case 26: return 0x09;
        case 27: return 0x10;
        default:
            LOG_ERROR("#ERR: err to case the channel type %d \n", channel);
            exit(1);
            return KT_ERROR;
    }
}

/****
 * 按位输出二进制
 */ 
void xprint(uint8 *tdata, uint64 dlen, uint16 rlen) {
    size_t i = 0;
    for(i = 0; i < dlen; i++) {
        LOG_INFO("%2x ", tdata[i]);
        if((i+1) % rlen == 0 && i != (dlen-1)) {
            LOG_INFO("\n");
        }
    }
    LOG_INFO("\n");
}